package statistic;

import common.db.DBExecute;
import common.main.MainBean;

public class ProductCountBean extends MainBean
{
	public void funcExecute() throws Exception
	{
		String from = (String)inputTable.get("from");
		String to = (String)inputTable.get("to");
		
		queryBuffer = new StringBuffer();
		
		queryBuffer.append("SELECT a.TIME, a.COUNT, a.GOODS_CODE, b.NAME FROM ( SELECT TO_CHAR(TIME,'yyyy-MM-dd') TIME, ");
		queryBuffer.append("COUNT(GOODS_CODE) COUNT, GOODS_CODE FROM PRODUCT_COUNT ");
		queryBuffer.append("WHERE TO_CHAR(TIME,'yyyy-MM-dd') >= '"+from+"' AND TO_CHAR(TIME,'yyyy-MM-dd') <= '"+to+"' ");
		queryBuffer.append("GROUP BY TIME, GOODS_CODE ");
		queryBuffer.append(") a, GOODS b WHERE a.GOODS_CODE = b.SEQ ORDER BY a.TIME");
		
		DBExecute dbe = new DBExecute(queryBuffer.toString());
		
		outputList = dbe.getDataList();
	}
}
